<?php
/**
 * Smithy PHP library
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * Smithy is a free Zend Framework based PHP library.
 *
 * @category   Smithy
 * @package    Smithy_Db
 * @subpackage Table
 * @copyright  Copyright (c) 2008-2009 Kovács Tamás
 * @license    New BSD License
 * @version    $Id: Abstract.php ktamas $
 */

/**
 * @see Zend_Db_Table_Row_Abstract
 */
require_once ('Zend/Db/Table/Row/Abstract.php');

/**
 * A basic Db table row class.
 *
 * @author      Kovács Tamás
 * @category    Smithy
 * @package     Smithy_Db
 * @subpackage  Table
 */
class Smithy_Db_Table_Row_Abstract extends Zend_Db_Table_Row_Abstract
{
    /**
     * Initialize object
     *
     * Called from {@link __construct()} as final step of object instantiation.
     *
     * @return void
     */
    public function setFromArray($data)
    {
        $ret = parent::setFromArray($data);

        $allPrimarySet = true;

        foreach ($this->_primary as $column) {
            if (empty($this->_data[$column])) {
                $allPrimarySet = false;
            }
        }
        if ($allPrimarySet) {
            $this->_cleanData = $this->_data;
        }

        return $ret;
    }
}
